package com.gitee.fdc.adminui.demo.domain;

import com.gitee.fdc.base.entity.BaseEntity;
import com.gitee.fdc.base.mapper.logicdelete.DeleteLogic;
import com.gitee.fdc.kits.StringUtils;
import javax.persistence.Table;
import lombok.Data;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

/**
 * 单样例表 demo_single_table
 *
 * @author Mr.fdc
 * @date 2019-05-20T08:56:53.535+08:00
 */
@Data
@Table(name = "demo_single_table")
@Document(indexName = "demo_single_table", type = "doc")
public class DemoSingleTable extends BaseEntity<Long> {

    private static final long serialVersionUID = 644911947176007629L;

    @Id
    @org.springframework.data.annotation.Id
    @GeneratedValue(generator = "JDBC")
    private Long id;

    /**
     * 整形字段
     */
    @Field
    private Integer intField;

    /**
     * 字符串字段
     */
//    @Field
//    @Column(name = "varchar_field")
//    @JsonProperty(value = "varchar_field")
    private String varcharField;
//    @Transient
//    private String varchar_field;
    /**
     * 日期字段
     */
    private Date dateField;

    /**
     * 下拉字典字段
     */
    private String selectDictField;
    private String multiSelectField;

    public String[] getMultiSelectFieldArray() {
        String[] sa = StringUtils.split(multiSelectField, ",");
        return sa == null ? new String[0] : sa;
    }
    /**
     * CHECK字典字段
     */
    private String checkDictField;

    public String[] getCheckDictFieldArray() {
        String[] sa = StringUtils.split(checkDictField, ",");
        return sa == null ? new String[0] : sa;
    }
    /**
     * REDIO字典字段
     */
    private String redioDictField;

    @DeleteLogic
    protected Integer delFlag = 0;
}
